package com.cssy.xxkj.logic.dao.impl;

import java.util.List;
import java.util.Map;

import org.springframework.dao.DataAccessException;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.cssy.xxkj.logic.dao.LogicWhCheckTaskDAO;
import com.cssy.xxkj.logic.entity.LogicWhCheckTaskDO;
import com.cssy.xxkj.logic.entity.vo.LogicWarehouseEndMonthSumVO;
import com.plat.exception.SyBaseException;
import com.plat.helper.SearchConditions;

/**
 * 数据访问对象实现类
 * @since 2014-09-30
 */
public class LogicWhCheckTaskDAOImpl extends SqlMapClientDaoSupport implements LogicWhCheckTaskDAO {

    /**
     * 插入数据
     * @param logicWhCheckTaskDO
     * @return 插入数据的主键
     */
    public String insertLogicWhCheckTaskDO(LogicWhCheckTaskDO logicWhCheckTaskDO) throws DataAccessException {
        Object id = getSqlMapClientTemplate().insert("LogicWhCheckTask.insert", logicWhCheckTaskDO);
        return (String) id;
    }

    /**
     * 统计记录数
     * @param logicWhCheckTaskDO
     * @return 查出的记录数
     */
    public Integer countLogicWhCheckTaskDOByExample(LogicWhCheckTaskDO logicWhCheckTaskDO) throws DataAccessException {
        Integer count = (Integer) getSqlMapClientTemplate().queryForObject("LogicWhCheckTask.countByDOExample", logicWhCheckTaskDO);
        return count;
    }

    /**
     * 更新记录
     * @param logicWhCheckTaskDO
     * @return 受影响的行数
     */
    public Integer updateLogicWhCheckTaskDO(LogicWhCheckTaskDO logicWhCheckTaskDO) throws DataAccessException {
        int result = getSqlMapClientTemplate().update("LogicWhCheckTask.update", logicWhCheckTaskDO);
        return result;
    }

    /**
     * 获取对象列表
     * @param logicWhCheckTaskDO
     * @return 对象列表
     */
    @SuppressWarnings("unchecked")
    public List<LogicWhCheckTaskDO> findListByExample(LogicWhCheckTaskDO logicWhCheckTaskDO) throws DataAccessException {
        List<LogicWhCheckTaskDO> list = getSqlMapClientTemplate().queryForList("LogicWhCheckTask.findListByDO", logicWhCheckTaskDO);
        return list;
    }

    /**
     * 根据主键获取logicWhCheckTaskDO
     * @param id
     * @return logicWhCheckTaskDO
     */
    public LogicWhCheckTaskDO findLogicWhCheckTaskDOByPrimaryKey(String id) throws DataAccessException {
        LogicWhCheckTaskDO logicWhCheckTaskDO = (LogicWhCheckTaskDO) getSqlMapClientTemplate().queryForObject("LogicWhCheckTask.findByPrimaryKey", id);
        return logicWhCheckTaskDO;
    }

    /**
     * 删除记录
     * @param id
     * @return 受影响的行数
     */
    public Integer deleteLogicWhCheckTaskDOByPrimaryKey(String id) throws DataAccessException {
        Integer rows = (Integer) getSqlMapClientTemplate().delete("LogicWhCheckTask.deleteByPrimaryKey", id);
        return rows;
    }

	@SuppressWarnings("unchecked")
	@Override
	public List<LogicWhCheckTaskDO> find(SearchConditions scs)
			throws DataAccessException {
		List<LogicWhCheckTaskDO> list = getSqlMapClientTemplate().queryForList("LogicWhCheckTask_ex.find", scs);
		return list;
	}

	@Override
	public Integer count(SearchConditions scs) throws DataAccessException {
		Integer count = (Integer) getSqlMapClientTemplate().queryForObject("LogicWhCheckTask_ex.count", scs);
	    return count;
	}

	@Override
	public Integer deleteBizRemoved(String id) throws DataAccessException {
		Integer count = (Integer) getSqlMapClientTemplate().delete("LogicWhCheckTask_ex.deleteBizRemoved", id);
	    return count;
	}

	@Override
	public LogicWhCheckTaskDO findLogicWhCheckTaskDOByMap(
			Map<String, Object> paramMap) throws SyBaseException {
		return (LogicWhCheckTaskDO) getSqlMapClientTemplate().queryForObject("", paramMap);
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<LogicWhCheckTaskDO> findLogicWhCheckTaskDOListByMap(
			Map<String, Object> paramMap) throws SyBaseException {
		return getSqlMapClientTemplate().queryForList("LogicWhCheckTask_ex.findLogicWhCheckTaskDOListByMap", paramMap);
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<LogicWarehouseEndMonthSumVO> findExcelQueryEndMonthToSummary(SearchConditions scs)throws SyBaseException{
		List<LogicWarehouseEndMonthSumVO> list = getSqlMapClientTemplate().queryForList("LogicWhCheckTask_ex.findExcelQueryEndMonthToSummary", scs);
		return list;
	}
	
	@SuppressWarnings("unchecked")
	@Override
	public List<LogicWarehouseEndMonthSumVO> findQueryEndMonthToSummary(SearchConditions scs)throws SyBaseException{
		List<LogicWarehouseEndMonthSumVO> list = getSqlMapClientTemplate().queryForList("LogicWhCheckTask_ex.findQueryEndMonthToSummary", scs);
		return list;
	}
}